import Cookies from 'js-cookie'

const TokenKey = 'vue_admin_template_token'

// 从cookies中获取token
export function getToken() {
  return Cookies.get(TokenKey)
}

// 存储token到cookie
export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

// 将token从cookie删除
export function removeToken() {
  return Cookies.remove(TokenKey)
}

// 设置一个独一无二的key
const timeKey = 'timestamp-key'
// 获取时间戳
export function getTimeStamp() {
  return Cookies.get(timeKey)
}
// 存入时间戳
export function setTimeStamp() {
  return Cookies.set(timeKey, Date.now())
}
